package com.spy.dish.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.spy.dish.mapper.DishStepMapper;
import com.spy.dish.domain.DishStep;
import com.spy.dish.service.IDishStepService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import java.util.Arrays;

/**
 * 菜品步骤Service业务层处理
 *
 * @author zhaoxy
 * @date 2025-11-09
 */
@Service
public class DishStepServiceImpl extends ServiceImpl<DishStepMapper, DishStep> implements IDishStepService {
    @Autowired
    private DishStepMapper dishStepMapper;

    /**
     * 查询菜品步骤
     *
     * @param id 菜品步骤主键
     * @return 菜品步骤
     */
    @Override
    public DishStep selectDishStepById(Long id) {
        return getById(id);
    }

    /**
     * 查询菜品步骤列表
     *
     * @param dishStep 菜品步骤
     * @return 菜品步骤
     */
    @Override
    public List<DishStep> selectDishStepList(DishStep dishStep) {
        return dishStepMapper.selectDishStepList(dishStep);
    }

    /**
     * 新增菜品步骤
     *
     * @param dishStep 菜品步骤
     * @return 结果
     */
    @Override
    public int insertDishStep(DishStep dishStep) {
        return save(dishStep) ? 1 : 0;
    }

    /**
     * 修改菜品步骤
     *
     * @param dishStep 菜品步骤
     * @return 结果
     */
    @Override
    public int updateDishStep(DishStep dishStep) {
        return updateById(dishStep) ? 1 : 0;
    }

    /**
     * 批量删除菜品步骤
     *
     * @param ids 需要删除的菜品步骤主键
     * @return 结果
     */
    @Override
    public int deleteDishStepByIds(Long[] ids) {
        return removeByIds(Arrays.asList(ids)) ? 1 : 0;
    }

    /**
     * 删除菜品步骤信息
     *
     * @param id 菜品步骤主键
     * @return 结果
     */
    @Override
    public int deleteDishStepById(Long id) {
        return removeById(id) ? 1 : 0;
    }
}